import { _decorator, Component, Node, Prefab, instantiate } from "cc";
import { MatchDigit } from "./MatchDigit";

const { ccclass, property } = _decorator;

@ccclass("MatchSpace")
export class MatchSpace extends Component {
  @property
  rotated: boolean = false;
  @property(Prefab)
  matchstickPre: Prefab;
  update(deltaTime: number) {}
  childChanged() {
    let matchdig = this.node.parent.getComponent(MatchDigit);
    matchdig.updateValue();
  }
  initData(dig: 1 | 0) {
    if (dig === 1) {
      let matchstick = instantiate(this.matchstickPre);
      matchstick.setParent(this.node);
    }
  }
}
